<html>
<head><meta charset="utf-8"><title>regions and universes · wg-traits · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/index.html">wg-traits</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html">regions and universes</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="183685875"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183685875" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183685875">(Dec 17 2019 at 20:04)</a>:</h4>
<p>Hey <span class="user-mention" data-user-id="116118">@Matthew Jasper</span></p>



<a name="183685923"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183685923" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183685923">(Dec 17 2019 at 20:04)</a>:</h4>
<p>Hi</p>



<a name="183685971"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183685971" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183685971">(Dec 17 2019 at 20:04)</a>:</h4>
<p>I'm trying to decide where to start</p>



<a name="183685996"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183685996" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183685996">(Dec 17 2019 at 20:04)</a>:</h4>
<p>I guess let me start with <a href="https://github.com/rust-lang/rust/issues/65232" target="_blank" title="https://github.com/rust-lang/rust/issues/65232">#65232</a></p>



<a name="183686005"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183686005" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183686005">(Dec 17 2019 at 20:05)</a>:</h4>
<p>I'd like to land that PR but I have a few concerns</p>



<a name="183686031"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183686031" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183686031">(Dec 17 2019 at 20:05)</a>:</h4>
<ul>
<li>it's a breaking change w/r/t coherence; this is maybe ok but I feel like there may be some procedural steps first</li>
</ul>



<a name="183686046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183686046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183686046">(Dec 17 2019 at 20:05)</a>:</h4>
<p>(e.g., maybe a warning period)</p>



<a name="183686059"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183686059" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183686059">(Dec 17 2019 at 20:05)</a>:</h4>
<p>in my ideal world, we would have an RFC that kind of lays out "the plan" for how to handle this stuff</p>



<a name="183686130"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183686130" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183686130">(Dec 17 2019 at 20:06)</a>:</h4>
<p>specifically I mean how to handle regions, higher-ranked subtyping, trait solving, and the interactions there</p>



<a name="183686159"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183686159" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183686159">(Dec 17 2019 at 20:06)</a>:</h4>
<p>I think it would actually be plausible to do a warning period</p>



<a name="183686167"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183686167" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183686167">(Dec 17 2019 at 20:06)</a>:</h4>
<p>or to preserve the existing region behavior</p>



<a name="183686174"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183686174" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183686174">(Dec 17 2019 at 20:06)</a>:</h4>
<p>by adding a check to cherence</p>



<a name="183686188"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183686188" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183686188">(Dec 17 2019 at 20:06)</a>:</h4>
<p>right now, the coherence test basially just ignores all the region constraints</p>



<a name="183686217"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183686217" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183686217">(Dec 17 2019 at 20:07)</a>:</h4>
<p>but we could instead try to solve them, or at least look for "cross-universe" constraints that are not solveable</p>



<a name="183686234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183686234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183686234">(Dec 17 2019 at 20:07)</a>:</h4>
<p>do you know the coherence interaction I am referring to?</p>



<a name="183686327"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183686327" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183686327">(Dec 17 2019 at 20:08)</a>:</h4>
<p>I know what the change in behaviour is. I don't really know how the coherence check works.</p>



<a name="183686396"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183686396" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183686396">(Dec 17 2019 at 20:08)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/94fe66d3df05a5f6329bae64e02dfe5ba09eb71a/src/test/ui/coherence/coherence-subtyping.rs" target="_blank" title="https://github.com/rust-lang/rust/blob/94fe66d3df05a5f6329bae64e02dfe5ba09eb71a/src/test/ui/coherence/coherence-subtyping.rs">the test</a></p>



<a name="183686408"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183686408" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183686408">(Dec 17 2019 at 20:09)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="k">trait</span><span class="w"> </span><span class="n">TheTrait</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">foo</span><span class="p">(</span><span class="o">&amp;</span><span class="bp">self</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">impl</span><span class="w"> </span><span class="n">TheTrait</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="k">for</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="p">,</span><span class="na">&#39;b</span><span class="o">&gt;</span><span class="w"> </span><span class="k">fn</span><span class="p">(</span><span class="o">&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="kt">u8</span><span class="p">,</span><span class="w"> </span><span class="o">&amp;</span><span class="na">&#39;b</span><span class="w"> </span><span class="kt">u8</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="kp">&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="kt">u8</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">impl</span><span class="w"> </span><span class="n">TheTrait</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="k">for</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="w"> </span><span class="k">fn</span><span class="p">(</span><span class="o">&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="kt">u8</span><span class="p">,</span><span class="w"> </span><span class="o">&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="kt">u8</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="kp">&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="kt">u8</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="183686448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183686448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183686448">(Dec 17 2019 at 20:09)</a>:</h4>
<p>I think the way to think about this is that</p>



<a name="183686483"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183686483" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183686483">(Dec 17 2019 at 20:09)</a>:</h4>
<p>you have the operation <code>TypeEqual(T1, T2)</code> which, in the compiler anyway, returns a set of region constraints <code>RC</code></p>



<a name="183686541"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183686541" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183686541">(Dec 17 2019 at 20:10)</a>:</h4>
<p>(or errors)</p>



<a name="183686552"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183686552" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183686552">(Dec 17 2019 at 20:10)</a>:</h4>
<p>i.e., the types are equal if  <code>RC</code> are satisfiable</p>



<a name="183686566"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183686566" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183686566">(Dec 17 2019 at 20:10)</a>:</h4>
<p>and the coherence code basically just ignores those constraints and considers things to potentially overlap, assuming <code>RC</code> is satisfiable</p>



<a name="183686630"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183686630" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183686630">(Dec 17 2019 at 20:11)</a>:</h4>
<p>we could probalby just <em>run</em> the region inference code and it'd be ok, though most of the regions would wind up being inferred to <code>'empty</code> or something</p>



<a name="183686635"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183686635" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183686635">(Dec 17 2019 at 20:11)</a>:</h4>
<p>because there are no real constraints</p>



<a name="183686656"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183686656" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183686656">(Dec 17 2019 at 20:11)</a>:</h4>
<p>that is, you have a bunch of variables, and they have to outlive one another, but there is nothing that forces them to be anything other than <code>'empty</code></p>



<a name="183686669"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183686669" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183686669">(Dec 17 2019 at 20:11)</a>:</h4>
<p><em>except</em> for universe placeholders, in this PR</p>



<a name="183686734"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183686734" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183686734">(Dec 17 2019 at 20:12)</a>:</h4>
<p>so e.g. here I think you would find that we can't infer a single <code>'a</code> that outlives <code>'!a</code> and <code>'!b</code> and yet is outlived by <code>'!a</code></p>



<a name="183686737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183686737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183686737">(Dec 17 2019 at 20:12)</a>:</h4>
<p>(does that make sense?)</p>



<a name="183686765"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183686765" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183686765">(Dec 17 2019 at 20:13)</a>:</h4>
<p>Yes.</p>



<a name="183686785"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183686785" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183686785">(Dec 17 2019 at 20:13)</a>:</h4>
<p>I feel like .. 90% sure that this would be "more or less" equivalent to today's code, modulo those cases where today's code is wrong</p>



<a name="183686807"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183686807" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183686807">(Dec 17 2019 at 20:13)</a>:</h4>
<p>Where the types really are the same.</p>



<a name="183686843"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183686843" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183686843">(Dec 17 2019 at 20:14)</a>:</h4>
<p>e.g., presumably </p>
<div class="codehilite"><pre><span></span><span class="k">impl</span><span class="w"> </span><span class="n">TheTrait</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="k">fn</span><span class="p">(</span><span class="o">&amp;</span><span class="kt">u8</span><span class="p">)</span><span class="w"></span>

<span class="k">impl</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="w"> </span><span class="n">TheTrait</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="k">fn</span><span class="p">(</span><span class="o">&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="kt">u8</span><span class="p">)</span><span class="w"></span>
</pre></div>


<p>would probably overlap, because there is at least one lifetime (<code>'empty</code>) where those types are the same</p>



<a name="183686913"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183686913" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183686913">(Dec 17 2019 at 20:14)</a>:</h4>
<p>similarly</p>
<div class="codehilite"><pre><span></span><span class="k">impl</span><span class="w"> </span><span class="n">TheTrait</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="k">for</span><span class="o">&lt;</span><span class="na">&#39;b</span><span class="o">&gt;</span><span class="w"> </span><span class="k">fn</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kp">&amp;</span><span class="na">&#39;b</span><span class="w"> </span><span class="kt">u8</span><span class="w"></span>

<span class="k">impl</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="w"> </span><span class="n">TheTrait</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="k">fn</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kp">&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="kt">u8</span><span class="w"></span>
</pre></div>


<p>which is equivalent in the case where <code>'a</code> is <code>'static</code></p>



<a name="183687003"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687003" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687003">(Dec 17 2019 at 20:16)</a>:</h4>
<p>I could certainly try implementing that, it'd be easy enough</p>



<a name="183687062"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687062" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687062">(Dec 17 2019 at 20:16)</a>:</h4>
<p>let me pivot slightly, to talk about the idea I had for how to handle regions in chalk</p>



<a name="183687070"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687070" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687070">(Dec 17 2019 at 20:16)</a>:</h4>
<p>which is related to this in some sense</p>



<a name="183687074"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687074" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687074">(Dec 17 2019 at 20:16)</a>:</h4>
<blockquote>
<p>but we could instead try to solve them, or at least look for "cross-universe" constraints that are not solveable</p>
</blockquote>
<p>Implementing this?</p>



<a name="183687083"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687083" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687083">(Dec 17 2019 at 20:16)</a>:</h4>
<p>right, I think I just have to add one or two lines of code</p>



<a name="183687099"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687099" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687099">(Dec 17 2019 at 20:16)</a>:</h4>
<p>well, before I pivot, let me add one last thing --</p>



<a name="183687130"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687130" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687130">(Dec 17 2019 at 20:17)</a>:</h4>
<p>I was debating at some point whether it would be possible to get away with the branch the way it is now (i.e., causing all those cases to overlap, even when the constraints are unsolveable)</p>



<a name="183687160"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687160" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687160">(Dec 17 2019 at 20:17)</a>:</h4>
<p>in part because I was hoping that could make it so that the first round of type-checking could <em>completely erase</em> regons, even erasing their binding locations</p>



<a name="183687177"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687177" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687177">(Dec 17 2019 at 20:17)</a>:</h4>
<p>this would basically change Rust's type system into a flat system w/o subtyping</p>



<a name="183687225"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687225" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687225">(Dec 17 2019 at 20:18)</a>:</h4>
<p>(I think?)</p>



<a name="183687235"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687235" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687235">(Dec 17 2019 at 20:18)</a>:</h4>
<p>which would be efficient</p>



<a name="183687251"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687251" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687251">(Dec 17 2019 at 20:18)</a>:</h4>
<p>and most users I've talked (even sophisticated ones) are surprised to learn that an impl for <code>fn(&amp;u8)</code> and an impl for <code>fn(&amp;'a u8)</code> are both permitted, etc</p>



<a name="183687255"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687255" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687255">(Dec 17 2019 at 20:18)</a>:</h4>
<p>(well, that specific example wouldn't be, but you know what I mean)</p>



<a name="183687303"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687303" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687303">(Dec 17 2019 at 20:19)</a>:</h4>
<p><em>however</em> I am not sure about that vision, and anyway I have to face the backwards compatibility facts -- i.e., I can't come up with a kind of compelling reason to justify rejecting some of these cases that are currently accepted</p>



<a name="183687366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687366">(Dec 17 2019 at 20:20)</a>:</h4>
<p>(except for the cases where there is legit overlap)</p>



<a name="183687385"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687385" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687385">(Dec 17 2019 at 20:20)</a>:</h4>
<p>but I guess there'd always be room to move to a future compatibility warning <em>later</em></p>



<a name="183687388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687388">(Dec 17 2019 at 20:20)</a>:</h4>
<p>after all, it's been literally this way since 1.0</p>



<a name="183687435"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687435" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687435">(Dec 17 2019 at 20:21)</a>:</h4>
<p>(the truth is that even with my change, the branch will be rejecting all the impls I know of that take advantage of distinguishing binding locations)</p>



<a name="183687439"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687439" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687439">(Dec 17 2019 at 20:21)</a>:</h4>
<p>(so I guess I need a warning anyway)</p>



<a name="183687448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687448">(Dec 17 2019 at 20:21)</a>:</h4>
<p>(or at least we might consider one)</p>



<a name="183687462"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687462" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687462">(Dec 17 2019 at 20:21)</a>:</h4>
<p>anyway, let me spell out my idea for chalk I guess?</p>



<a name="183687464"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687464" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687464">(Dec 17 2019 at 20:21)</a>:</h4>
<p>/me pauses</p>



<a name="183687531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687531">(Dec 17 2019 at 20:22)</a>:</h4>
<p>Go ahead</p>



<a name="183687571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687571">(Dec 17 2019 at 20:23)</a>:</h4>
<p>ok so</p>



<a name="183687577"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687577" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687577">(Dec 17 2019 at 20:23)</a>:</h4>
<p>the idea was roughly this</p>



<a name="183687605"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687605" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687605">(Dec 17 2019 at 20:23)</a>:</h4>
<p>the idea was to consider <code>Outlives('a: 'b)</code> a predicate that must be "proven" like any other logical predicate</p>



<a name="183687661"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687661" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687661">(Dec 17 2019 at 20:24)</a>:</h4>
<p>(whereas today, chalk just kind of "records" them as constraints and never tries to solve them)</p>



<a name="183687678"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687678" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687678">(Dec 17 2019 at 20:24)</a>:</h4>
<p>there would be a few base rules that we supply for doing that</p>



<a name="183687689"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687689" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687689">(Dec 17 2019 at 20:24)</a>:</h4>
<div class="codehilite"><pre><span></span>forall&lt;&#39;x&gt; { Outlives(&#39;static: &#39;x) }
</pre></div>



<a name="183687717"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687717" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687717">(Dec 17 2019 at 20:24)</a>:</h4>
<div class="codehilite"><pre><span></span>forall&lt;&#39;a, &#39;b, &#39;c&gt; {
    Outlives(&#39;a: &#39;c) :-
      Outlives(&#39;a: &#39;b),
      Outlives(&#39;b: &#39;c)
}
</pre></div>



<a name="183687735"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687735" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687735">(Dec 17 2019 at 20:25)</a>:</h4>
<p>and the last rule, which is important</p>



<a name="183687751"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687751" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687751">(Dec 17 2019 at 20:25)</a>:</h4>
<div class="codehilite"><pre><span></span>Outlives(&#39;a: &#39;b) :- RecordOutlives(&#39;a: &#39;b)
</pre></div>



<a name="183687761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687761">(Dec 17 2019 at 20:25)</a>:</h4>
<p>so what is this "record outlives"?</p>



<a name="183687800"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687800" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687800">(Dec 17 2019 at 20:25)</a>:</h4>
<p>this is kind of a built-in thing that "records" the constraint for NLL (or polonius...) to solve, but it can only be done if <code>'a</code> and <code>'b</code> are in the root universe</p>



<a name="183687853"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687853" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687853">(Dec 17 2019 at 20:26)</a>:</h4>
<p>the intution here being that if I have a query to prove like</p>
<div class="codehilite"><pre><span></span>TypeEqual(&amp;&#39;a u8 = &amp;&#39;b u8)
</pre></div>



<a name="183687880"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687880" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687880">(Dec 17 2019 at 20:26)</a>:</h4>
<p>where <code>'a</code> and <code>'b</code> are kind of "free" lifetimes, maybe I put them in the root universe (bear with me on that, I'm going to be hand-wavy for a second about the "root universe" I guess)</p>



<a name="183687903"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687903" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687903">(Dec 17 2019 at 20:26)</a>:</h4>
<p>in that case I would be forced to prove <code>Outlives('a: 'b)</code> and <code>Outlives('b: 'a)</code>, both of which I can prove by recording</p>



<a name="183687921"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687921" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687921">(Dec 17 2019 at 20:27)</a>:</h4>
<p>so I get back those two things as region constraints that must be solved later</p>



<a name="183687944"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687944" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687944">(Dec 17 2019 at 20:27)</a>:</h4>
<p>however, if I have something like</p>
<div class="codehilite"><pre><span></span>for&lt;&#39;a&gt; fn(&amp;&#39;a u8) &lt;: fn(&amp;&#39;b u8)
</pre></div>



<a name="183687968"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183687968" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183687968">(Dec 17 2019 at 20:27)</a>:</h4>
<p>now I would wind up having to prove something like <code>'b: '!a</code> for some placeholer <code>'!a</code> that is not in the root universe</p>



<a name="183688014"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688014" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688014">(Dec 17 2019 at 20:28)</a>:</h4>
<p>I can't "record" that one, so I have to justify it some other way</p>



<a name="183688058"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688058" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688058">(Dec 17 2019 at 20:28)</a>:</h4>
<p>for example, I could see that <code>'static: '!a</code> (base rule) and that we could prove <code>Outlives('b: 'static)</code> by recording (both <code>'b</code> and <code>'static</code> are in root universe) and hence by transitivity we're done</p>



<a name="183688079"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688079" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688079">(Dec 17 2019 at 20:29)</a>:</h4>
<p>i.e., we wind up recording that this is true if <code>'b: 'static</code></p>



<a name="183688083"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688083" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688083">(Dec 17 2019 at 20:29)</a>:</h4>
<p>/me wonders if he got that right</p>



<a name="183688092"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688092" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688092">(Dec 17 2019 at 20:29)</a>:</h4>
<p>I guess so :)</p>



<a name="183688103"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688103" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688103">(Dec 17 2019 at 20:29)</a>:</h4>
<p>this is basically the same behavior that our region solver is doing in that PR, of course</p>



<a name="183688106"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688106" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688106">(Dec 17 2019 at 20:29)</a>:</h4>
<p>No, <code>'a</code> becomes an inference variable.</p>



<a name="183688115"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688115" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688115">(Dec 17 2019 at 20:29)</a>:</h4>
<p>yeah, ok, well, you get the idea :P</p>



<a name="183688123"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688123" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688123">(Dec 17 2019 at 20:29)</a>:</h4>
<p>:P</p>



<a name="183688130"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688130" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688130">(Dec 17 2019 at 20:29)</a>:</h4>
<p>(maybe)</p>



<a name="183688207"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688207" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688207">(Dec 17 2019 at 20:30)</a>:</h4>
<blockquote>
<p>No, <code>'a</code> becomes an inference variable.</p>
</blockquote>
<p>glad you saw that, because it seemed like what I was saying made no sense when I ported it back to the original types</p>



<a name="183688212"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688212" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688212">(Dec 17 2019 at 20:30)</a>:</h4>
<p>ok, change the example to</p>



<a name="183688235"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688235" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688235">(Dec 17 2019 at 20:30)</a>:</h4>
<div class="codehilite"><pre><span></span>fn() -&gt; &amp;&#39;b u8 &lt;: for&lt;&#39;a&gt; fn() -&gt; &amp;&#39;a u8
</pre></div>



<a name="183688272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688272">(Dec 17 2019 at 20:30)</a>:</h4>
<p>(man that's hard to parse)</p>



<a name="183688284"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688284" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688284">(Dec 17 2019 at 20:31)</a>:</h4>
<p>That looks better...</p>



<a name="183688302"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688302" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688302">(Dec 17 2019 at 20:31)</a>:</h4>
<p>but at least it makes sense that <code>'b = 'static</code> is a solution :)</p>



<a name="183688326"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688326" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688326">(Dec 17 2019 at 20:31)</a>:</h4>
<p>anyway what's neat about this is that (e.g.) polonius doesn't have to care about anything higher-ranked or higher-order or whatever</p>



<a name="183688330"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688330" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688330">(Dec 17 2019 at 20:31)</a>:</h4>
<p>plus it fits with some other things I'd like to do</p>



<a name="183688337"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688337" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688337">(Dec 17 2019 at 20:31)</a>:</h4>
<p>e.g., I'd like to be able to do</p>



<a name="183688345"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688345" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688345">(Dec 17 2019 at 20:31)</a>:</h4>
<div class="codehilite"><pre><span></span>forall&lt;&#39;a, &#39;b&gt; { if (&#39;a: &#39;b, &#39;b: &#39;a) { &amp;&#39;a u8 = &amp;&#39;b u8 } }
</pre></div>



<a name="183688388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688388">(Dec 17 2019 at 20:32)</a>:</h4>
<p>this could plausibly be solved by chalk all by itself</p>



<a name="183688394"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688394" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688394">(Dec 17 2019 at 20:32)</a>:</h4>
<p>more importantly, perhaps</p>



<a name="183688417"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688417" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688417">(Dec 17 2019 at 20:32)</a>:</h4>
<p>consider a type like </p>
<div class="codehilite"><pre><span></span>for&lt;&#39;a, &#39;b&gt; fn(Foo&lt;&#39;a, &#39;b&gt;)
</pre></div>



<a name="183688431"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688431" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688431">(Dec 17 2019 at 20:32)</a>:</h4>
<p>where <code>struct Foo&lt;'a, 'b: 'a&gt;</code></p>



<a name="183688481"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688481" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688481">(Dec 17 2019 at 20:33)</a>:</h4>
<p>here, although we don't yet know what <code>'a</code> and <code>'b</code> are, we do know that you should pick choices that make <code>Foo&lt;'a, 'b&gt;</code> WF</p>



<a name="183688507"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688507" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688507">(Dec 17 2019 at 20:33)</a>:</h4>
<p>(the current compiler's handling of this is not sound, which is a longstanding bug, thoughh I can't find the issue number just now)</p>



<a name="183688562"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688562" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688562">(Dec 17 2019 at 20:34)</a>:</h4>
<p>but also we sometimes hit cases where we are far too conservative today</p>



<a name="183688569"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688569" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688569">(Dec 17 2019 at 20:34)</a>:</h4>
<p>I've seen it</p>



<a name="183688584"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688584" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688584">(Dec 17 2019 at 20:34)</a>:</h4>
<p>however, with this setup, we could do things like</p>
<div class="codehilite"><pre><span></span>forall&lt;&#39;a, &#39;b&gt; {
    if (WF(Foo&lt;&#39;a, &#39;b&gt;)) {
        ...
</pre></div>



<a name="183688593"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688593" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688593">(Dec 17 2019 at 20:34)</a>:</h4>
<p>and use the implied bounds setup to figure out that this means that <code>'a: 'b</code></p>



<a name="183688606"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688606" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688606">(Dec 17 2019 at 20:34)</a>:</h4>
<p>(I'm not sure how familiar you are with the chalk notation etc, so I'm assuming you'll ask me questions etc)</p>



<a name="183688629"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688629" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688629">(Dec 17 2019 at 20:35)</a>:</h4>
<p>there is one "fly in the ointment", so to speak, but that's the basic idea</p>



<a name="183688643"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688643" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688643">(Dec 17 2019 at 20:35)</a>:</h4>
<p>sorry, I should give a bit more context</p>



<a name="183688662"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688662" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688662">(Dec 17 2019 at 20:35)</a>:</h4>
<p>I kind of wanted to "reinterpret" the WF rules on <code>fn</code> types</p>



<a name="183688673"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688673" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688673">(Dec 17 2019 at 20:35)</a>:</h4>
<p>right now, we basically just <em>don't</em> validate the WF for things inside binders at all</p>



<a name="183688735"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688735" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688735">(Dec 17 2019 at 20:36)</a>:</h4>
<p>and if you were just kind of naive then <code>for&lt;'a, 'b&gt; fn(Foo&lt;'a, 'b&gt;)</code> would not be WF because we don't have any constraints on <code>'a</code> and <code>'b</code></p>



<a name="183688763"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688763" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688763">(Dec 17 2019 at 20:36)</a>:</h4>
<p>but if we use an "implied bounds" setup, then we might say that there is an <em>implied</em> set of where clauses for <code>fn</code> types</p>



<a name="183688772"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688772" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688772">(Dec 17 2019 at 20:36)</a>:</h4>
<p>that require all their argument types (and return type) to be WF</p>



<a name="183688793"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688793" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688793">(Dec 17 2019 at 20:36)</a>:</h4>
<p>then you can extend fn subtyping to say that those bounds (now made explicit) must subsume one another</p>



<a name="183688806"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688806" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688806">(Dec 17 2019 at 20:37)</a>:</h4>
<p>so e.g. <code>for&lt;'a&gt; fn</code> is really short (internally) for <code>for&lt;...&gt; if(C) fn(...)</code></p>



<a name="183688829"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688829" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688829">(Dec 17 2019 at 20:37)</a>:</h4>
<p>and hence when you have <code>for&lt;..&gt; if(C) fn(...) &lt;: for&lt;...&gt; if(D) fn(..)</code></p>



<a name="183688835"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688835" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688835">(Dec 17 2019 at 20:37)</a>:</h4>
<p>there must be some relationship between <code>C</code> and <code>D</code></p>



<a name="183688847"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688847" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688847">(Dec 17 2019 at 20:37)</a>:</h4>
<p>i.e., assuming <code>D</code>, you can prove <code>C</code>, or maybe vice versa :P</p>



<a name="183688853"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688853" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688853">(Dec 17 2019 at 20:37)</a>:</h4>
<p>/me thinks for a second :)</p>



<a name="183688925"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688925" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688925">(Dec 17 2019 at 20:38)</a>:</h4>
<p>I thnk that's right... the caller will only have to prove D, so that should imply C</p>



<a name="183688960"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688960" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688960">(Dec 17 2019 at 20:38)</a>:</h4>
<p>anyway, there <em>is</em> a fly in the ointment, as I said, but that's the big picture I was kind of shooting for</p>



<a name="183688986"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183688986" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183688986">(Dec 17 2019 at 20:38)</a>:</h4>
<p>the fly is basically that the rules I gave will result in a lot of possible solutions</p>



<a name="183689004"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183689004" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183689004">(Dec 17 2019 at 20:39)</a>:</h4>
<p>I'm not 100% sure how to handle that :)</p>



<a name="183689017"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183689017" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183689017">(Dec 17 2019 at 20:39)</a>:</h4>
<p>i.e., left to its own devices, chalk would kind of try to enumerate way too many possibilities</p>



<a name="183689036"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183689036" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183689036">(Dec 17 2019 at 20:39)</a>:</h4>
<p>I think though we can tweak the way we express the rules to be a bit less redundant --</p>



<a name="183689056"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183689056" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183689056">(Dec 17 2019 at 20:39)</a>:</h4>
<p>and no matter what way you slice it, there is a separate thing, that we're going to have to add some notion of "or" into the cosntraints, so that you get back a variety of possible constraints</p>



<a name="183689111"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183689111" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183689111">(Dec 17 2019 at 20:40)</a>:</h4>
<p>which we can then simplify, in some cases, though in the limit we might just have multiple possibilities we have to check</p>



<a name="183689128"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183689128" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183689128">(Dec 17 2019 at 20:40)</a>:</h4>
<p>see e.g. <a href="https://github.com/rust-lang/rust/issues/21974" target="_blank" title="https://github.com/rust-lang/rust/issues/21974">https://github.com/rust-lang/rust/issues/21974</a></p>



<a name="183689132"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183689132" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183689132">(Dec 17 2019 at 20:40)</a>:</h4>
<p>but I think that's an orthogonal problem</p>



<a name="183689160"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183689160" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183689160">(Dec 17 2019 at 20:40)</a>:</h4>
<p>Hopefully.</p>



<a name="183689166"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183689166" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183689166">(Dec 17 2019 at 20:40)</a>:</h4>
<p>my plan for now was that chalk would produce <code>C || D</code> constraints, but that the solver would sort do <em>something</em>, e.g. maybe conver them to <code>C &amp;&amp; D</code> at worst</p>



<a name="183689179"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183689179" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183689179">(Dec 17 2019 at 20:41)</a>:</h4>
<p>it seems like step 1 would be producing the correct constraints</p>



<a name="183689188"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183689188" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183689188">(Dec 17 2019 at 20:41)</a>:</h4>
<p>then we have to think about how to solve them...</p>



<a name="183689193"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183689193" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183689193">(Dec 17 2019 at 20:41)</a>:</h4>
<p>We do that for closures.</p>



<a name="183689197"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183689197" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183689197">(Dec 17 2019 at 20:41)</a>:</h4>
<p>right</p>



<a name="183689216"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183689216" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183689216">(Dec 17 2019 at 20:41)</a>:</h4>
<p>another interesting thought experiment: solve all possible sets of cosntraints, but use some kind of incremental dataflow to try and avoid redoing work :)</p>



<a name="183689226"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183689226" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183689226">(Dec 17 2019 at 20:41)</a>:</h4>
<p>that is so far down the line it might as well be outer space</p>



<a name="183689244"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183689244" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183689244">(Dec 17 2019 at 20:41)</a>:</h4>
<p>unfortunately, I have to run and go shovel the walk :)</p>



<a name="183689304"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183689304" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183689304">(Dec 17 2019 at 20:42)</a>:</h4>
<p>but I'll come back in a bit, hopefully that made some sense to you, I'd be curious to know if you see any obvious flaws (either today or at some later point)</p>



<a name="183689321"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183689321" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183689321">(Dec 17 2019 at 20:42)</a>:</h4>
<p>ah there was one last thing I didn't mention...</p>



<a name="183689356"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183689356" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183689356">(Dec 17 2019 at 20:42)</a>:</h4>
<p>having to do how, in polonius, regions can really be "sets" of lifetimes</p>



<a name="183689369"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183689369" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183689369">(Dec 17 2019 at 20:43)</a>:</h4>
<p>which I think is neat and useful but there is some interaction here for complex cases</p>



<a name="183689403"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183689403" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183689403">(Dec 17 2019 at 20:43)</a>:</h4>
<p>e.g. if you had <code>if ('a: 'b, 'a: 'c)</code>, and you had to prove <code>exists&lt;'x&gt; { 'x: 'a</code> and <code>'x: 'b }</code></p>



<a name="183689407"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183689407" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183689407">(Dec 17 2019 at 20:43)</a>:</h4>
<p>I think that chalk would be forced to say <code>'x = 'a</code></p>



<a name="183689422"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183689422" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183689422">(Dec 17 2019 at 20:43)</a>:</h4>
<p>but polonius might say <code>'x = union('a, 'b)</code></p>



<a name="183689472"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183689472" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183689472">(Dec 17 2019 at 20:44)</a>:</h4>
<p>I don't actually know that this matters much in <em>some</em> sense</p>



<a name="183689495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183689495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183689495">(Dec 17 2019 at 20:44)</a>:</h4>
<p>like I think the same set of constraints are solveable</p>



<a name="183689499"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183689499" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183689499">(Dec 17 2019 at 20:44)</a>:</h4>
<p>it's just a matter of how "precise" the solutions are</p>



<a name="183689525"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183689525" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183689525">(Dec 17 2019 at 20:45)</a>:</h4>
<blockquote>
<p>having to do how, in polonius, regions can really be "sets" of lifetimes</p>
</blockquote>
<p>I think this could be useful for <code>impl Trait</code> and capture clausees</p>



<a name="183689541"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183689541" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183689541">(Dec 17 2019 at 20:45)</a>:</h4>
<p>ok, have to go now <span aria-label="snowflake" class="emoji emoji-2744" role="img" title="snowflake">:snowflake:</span></p>



<a name="183689545"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/183689545" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#183689545">(Dec 17 2019 at 20:45)</a>:</h4>
<p><span aria-label="wave" class="emoji emoji-1f44b" role="img" title="wave">:wave:</span></p>



<a name="184023505"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/184023505" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#184023505">(Dec 21 2019 at 19:54)</a>:</h4>
<blockquote>
<p>it's just a matter of how "precise" the solutions are</p>
</blockquote>
<p>I was going to say that it matters for cases like this: <a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=169cdb4aaa19abce2baa2b45e876f797" target="_blank" title="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=169cdb4aaa19abce2baa2b45e876f797">https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=169cdb4aaa19abce2baa2b45e876f797</a>. But that causes the compiler to ICE...</p>



<a name="184025135"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/184025135" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#184025135">(Dec 21 2019 at 20:44)</a>:</h4>
<p>In cases like the above I guess we could preemptively add another region for <code>union('d, 'e)</code> so that we have something for the region to be inferred to.</p>



<a name="184098152"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/184098152" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#184098152">(Dec 23 2019 at 11:20)</a>:</h4>
<p>That case is hurting my head =)</p>



<a name="184098291"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/184098291" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#184098291">(Dec 23 2019 at 11:23)</a>:</h4>
<p>(Note though that <code>union</code> in polonius terms is more like intersection in lifetimes, in case that's relevant)</p>



<a name="184098299"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/184098299" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#184098299">(Dec 23 2019 at 11:23)</a>:</h4>
<p>Let me try to break that example into relations :)</p>



<a name="184098775"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/regions%20and%20universes/near/184098775" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/regions.20and.20universes.html#184098775">(Dec 23 2019 at 11:34)</a>:</h4>
<ul>
<li><code>for&lt;'c&gt; fn(fn(&amp;'c fn(&amp;'c))) &lt;: fn(fn(&amp;'a fn(&amp;'d)))</code></li>
<li><code>fn(&amp;'a fn(&amp;'d)) &lt;: fn(&amp;'?c fn(&amp;'?c))</code></li>
<li><code>&amp;'?c fn(&amp;'?c) &lt;: &amp;'a fn(&amp;'d)</code> =&gt; <code>'?c: 'a</code></li>
<li><code>fn(&amp;'?c) &lt;: fn(&amp;'d)</code></li>
<li><code>&amp;'d &lt;: &amp;'?c</code> =&gt; <code>'d: '?c</code> (etc)</li>
</ul>
<p>So put that all together and you get</p>
<ul>
<li><code>'?c: 'a</code></li>
<li><code>'?c: 'b</code></li>
<li><code>'d: '?c</code></li>
<li><code>'e: '?c</code></li>
</ul>
<p>and we know from implied bounds that :</p>
<ul>
<li><code>'d: 'a</code>, </li>
<li><code>'e: 'a</code>, </li>
<li><code>'d: 'b</code>, </li>
<li><code>'e: 'b</code>.</li>
</ul>
<p>So yeah that's a case where we can't grow to d, e, or static -- not sure why I thought that couldn't arise, seems like exactly the sort of constraints that you would be looking for. =) </p>
<p>In any case, yes, I think the fallback would be to augment the solver either by introducing <code>union</code> or by making the value of a region equal to a set, but I'm not sure what that latter change would do <em>precisely</em>.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>